# Maintainer: Hannah von Reth <vonreth@kde.org>

_variant=-${KF5_VARIANT:-shared}
source "$(dirname ${BASH_SOURCE[0]})"/../mingw-w64-PKGBUILD-common/kde-frameworks5
_kde_f5_init_package "${_variant}" "snorenotify"
#_realname=snorenotify
pkgbase=mingw-w64-${_basename}
pkgname="${MINGW_PACKAGE_PREFIX}-${_basename}"
provides=("${MINGW_PACKAGE_PREFIX}-Snorenotify")
replaces=("${MINGW_PACKAGE_PREFIX}-Snorenotify")
pkgver=0.7.0
pkgrel=3
pkgdesc="Snorenotify is a multi platform Qt notification framework. Using a plugin system it is possible to create notifications with many different notification systems on Windows, Mac OS and Unix and mobile Devices (mingw-w64)"
arch=('any')
license=("LGPL3")
url="https://techbase.kde.org/Projects/Snorenotify"
depends=()
_kde_f5_add_depends "${_variant}" "${MINGW_PACKAGE_PREFIX}-qt5${_namesuff}"
_kde_f5_add_depends "${_variant}" "${MINGW_PACKAGE_PREFIX}-snoregrowl"
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
            "${MINGW_PACKAGE_PREFIX}-cmake"
            "${MINGW_PACKAGE_PREFIX}-extra-cmake-modules")
options=(!strip staticlibs !buildflags)
source=("${_basename}-${pkgver}".tar.xz::"https://download.kde.org/stable/${_basename}/${pkgver}/src/${_basename}-${pkgver}.tar.xz")
sha256sums=('6d411ba6e31a73db56d298195f8336f66f8fe4fffd64d5fde3f14090e68ee64b')

build() {
  mkdir -p ${srcdir}/build-${MINGW_CHOST}${_variant}
  cd ${srcdir}/build-${MINGW_CHOST}${_variant}
  
  local -a extra_config
  if [ "${_variant}" = "-static" ]; then
    extra_config+=( -DBUILD_SHARED_LIBS=NO )
  fi

  _kde_f5_build_env
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_BUILD_TYPE=$(_kde_f5_CMAKE_BUILD_TYPE) \
    "${_kde_f5_KDE_INSTALL_DIRS[@]}" \
    "${extra_config[@]}" \
    ../${_basename}-${pkgver}

  make # VERBOSE=1
}

package() {
  cd ${srcdir}/build-${MINGW_CHOST}${_variant}
  make DESTDIR=${pkgdir} install
}
